<?php 
	$url_teacher_add = $this->url(array('module'=>'teacher','controller'=>'index','action'=>'add-teacher'));
	$url_teacher_cancel = $this->url(array('module'=>'teacher','controller'=>'index','action'=>'list'));
?>
<style>
<!--
tr td.tds{
	width: 15%; padding:10px 20px;
}
tr td.tdtext{
	width: 35%;
}
-->
</style>
<form action="<?php echo $url_teacher_add;?>" method="post" id="frm" enctype="multipart/form-data">
      <div id="page-wrapper">
        <div class="row">
        <div class="panel-heading" style=" width: 80%; margin:0 auto;">    	  
        	 <h3 style="color:#00F">Create User Teacher </h3>
          <button name="save_new" value="save_new" class="btn btn-small btn-primary">
			<b><i class="fa fa-plus"></i></b> &nbsp;Save New 
		  </button>
		  <button name="save_colse" value="save_colse" class="btn btn-small btn-primary">
		  <b><i class="icon-check"></i></b> &nbsp;Save Colse	
		  </button>
		  <a href="<?php echo $url_teacher_cancel;?>">
		  <button type="button" name="cancel" value="cancel" class="btn btn-small btn-warning">
			  <b><i class="fa fa-times"></i></b> &nbsp;Cancel					 
		  </button>
		  </a>
		  <div style="width: 20%; float: right;"><?php echo $this->frmteacher->getElement("id_code");?></div><div style="float: right; margin: 5px 0 30px 0;">ID Code Teacher : </div>
        </div>        
        <table border="0" cellpadding="5" width="90%" style="margin:0 auto;">
        	<tr>
            	<td class="tds">User Name Teacher :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("teacher_name");?></td>
                <td class="tds">Gender :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("gender");?></td>
            </tr>
            <tr>
            	<td class="tds">Password :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("password");?></td>
                <td class="tds">Verify Password: :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("confirm_password");?></td>
            </tr>
            <tr>
            	<td class="tds">Email :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("email");?></td>
                <td class="tds">Phone Number :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("tel");?></td>
            </tr>
            <tr>
            	<td class="tds">Address :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("address");?></td>
            	<td class="tds">Place of Birth :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("pob");?></td>
            </tr>
            <tr>
            	<td class="tds">Date fo Birth :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("dob");?></td>
            	
                
             <tr>
            	<td class="tds">Education:</td>
                <td class="tdtext" colspan="3"> 
					<div id="tabs" class="tabs-bottom">		
						<div id="tabs-1">
							<div class="head_form">
							<?php echo "Table Subject";?>
							</div>
					   	<div class="contain_form">
					   		<div class="">
					   			<table class="" id="table_edu">
									<tr height="33px">
										<td class="sub-tdheader"><?php echo ("Delete");?></td>
										<td class="sub-tdheader"><?php echo ("ID");?></td>
										<td class="sub-tdheader"><?php echo ("Education");?></td>
										<td class="sub-tdheader"><?php echo ("Finish From");?></td>
										<td class="sub-tdheader"><?php echo ("Year");?></td>
									</tr>
								</table>
								<input type="hidden" id="identity_edu" name="identity_edu" />
								<table>
									<tr>
										<td class="new-row">
											<div class="btn">
												<button class="positive" type="button" id="new_edu"  name= "new_followup" value="New">
													&nbsp;<img src="<?php echo BASE_URL?>/images/icon/new-row.png" alt=""/>ADD
												</button>
											</div>
										</td>
									</tr>
								</table>
							</div>      
					   	</div><!-- end of .contain_table -->
					 </div><!-- tab 1 -->				
					</div><!-- end main tab -->	
                <?php // echo $this->frmteacher->getElement("subject");?>
                </td>
            </tr>
			
								
            <tr>
            	<td class="tds"> Chose Department :</td>
                <td class="tdtext"> 
                	<div class="style-form" style="text-align: center;">
						<div class="" style="padding:10px 5px;"> 
							<div class="" style="height: 35px; text-align: left;">
								<div class="blocksearch">
									<select style="height: 35px;" id="department_id" name="department_id" Onchange="getdptOrder()"  class="chosen-select form-control"  style="width:100% ;margin:0 auto;" tabindex="4">
										<?php echo $this->department; ?>
									</select>
								</div>
							</div>
						</div>
					</div>
                </td>
            	<td class="tds">Status :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("status");?></td>
            </tr>
             <tr>
            	<td class="tds">Subject :</td>
                <td class="tdtext"> 
	                <div class="style-form" style="text-align: center;">
						<div class="" style="padding:10px 5px;"> 
							<div class="" style="height: 35px; text-align: left;">
								<div class="blocksearch">
									<select style="height: 35px;" id="add_subject" name="add_subject" Onchange="getsubjectOrder()"  class="chosen-select form-control"  style="width:100% ;margin:0 auto;" tabindex="4" placeholder="Please Select Subject">
										<?php //echo $this->subjects; ?>
									</select>
								</div>
							</div>
						</div>
					</div>
					<div id="tabs" class="tabs-bottom">		
						<div id="tabs-1">
							<div class="head_form">
							<?php echo "Table Subject";?>
							</div>
					   	<div class="contain_form">
					   		<div class="">
					   			<table class="" id="table_order">
									<tr height="33px">
										<td class="sub-tdheader"><?php echo ("Delete");?></td>
										<td class="sub-tdheader"><?php echo ("ID");?></td>
										<td class="sub-tdheader"><?php echo ("Subject Name");?></td>
										<input type="hidden" id="identity" name="identity" />
									</tr>
								</table>
							</div>      
					   	</div><!-- end of .contain_table -->
					 </div><!-- tab 1 -->				
					</div><!-- end main tab -->	
                <?php // echo $this->frmteacher->getElement("subject");?>
                </td>
            	<td class="tds">Skill :</td>
                <td class="tdtext"> <?php //echo $this->frmteacher->getElement("skill");?>
                <div class="style-form" style="text-align: center;">
						<div class="" style="padding:10px 5px;"> 
							<div class="" style="height: 35px; text-align: left;">
								<div class="blocksearch">
									<select style="height: 35px;" id="add_skill" name="add_skill" Onchange="getskill()"  class="chosen-select form-control"  style="width:100% ;margin:0 auto;" tabindex="4">
										<?php echo $this->skills; ?>
									</select>
								</div>
							</div>
						</div>
					</div>
					<div id="tabs" class="tabs-bottom">		
						<div id="tabs-1">
							<div class="head_form">
							<?php echo "Table Skill";?>
							</div>
					   	<div class="contain_form">
					   		<div class="">
					   			<table class="" id="table_orders">
									<tr height="33px">
										<td class="sub-tdheader"><?php echo ("Delete");?></td>
										<td class="sub-tdheader"><?php echo ("ID");?></td>
										<td class="sub-tdheader"><?php echo ("Skill Name");?></td>
									</tr>
									<input type="hidden" id="identitysk" name="identitysk" />
								</table>
							</div>      
					   	</div><!-- end of .contain_table -->
					 </div><!-- tab 1 -->				
					</div><!-- end main tab -->	
                </td>
            </tr>
            <tr>            	               
            	<td class="tds">Description :</td>
                <td class="tdtext"> <?php echo $this->frmteacher->getElement("description");?></td>
                <td class="tds">Photo :</td>
                <td class="tdtext" style="text-align: center;">
                	<?php if($this->frmteacher->getElement("photo") !=null){ ?>
                		<img width="160px" title="Porfile" src="<?php echo $this->baseUrl();?>/images/images_profile.jpg" />
                	<?php } else {?>
                		<img width="160px" title="Porfile" src="<?php echo $this->baseUrl();?>/images/<?php echo $this->frmteacher->getElement('photo');?>"/>
                	<?php }?>
                	<?php echo $this->frmteacher->getElement("photo");?>
                </td>
                
            </tr>
        </table>
        
        </div><!-- /#page-row -->
      </div><!-- /#page-wrapper -->
</form>
 <!-- end new Skill -->
<div id="overlay-location" class="web_dialog_overlay"></div>
		<?php $form_skill = $this->add_frmskill; ?>
		<div id="dialog-location" class="web_dialog">
		<form id="frm-skill" method="post">
			<div class="web_dialog_title" align="center"><?php echo "Add New Skill"?>
				<a href="#" id="btnCloseLocation" class="cancelDailog"></a>
			</div>
			<table style="width: 100%; margin:0 auto;" cellpadding="3" cellspacing="0">
				
				<tr>
					<td>Skill Name</td>
					<td><?php echo $form_skill->getElement("skills");?></td>
				</tr>
				<tr>
					<td>Status </td>
					<td><?php echo $form_skill->getElement("skill_status");?></td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: center;">
						<input id="btn_add" Onclick="addNewSkill()" type="button" value="Add Skill" />
						<input id="btncancel_location" class="cancelDailog" type="button" value="Cancel" />
					</td>
					<td colspan="2"></td>
				</tr>
	       </table>
	     </form>
 		</div>
 		
 		
 		<?php $form_edu = $this->add_edu; ?>
		<div id="dialog-edu" class="web_dialog" style="width:50%">
		<form id="frm-edu" method="post">
			<div class="web_dialog_title" align="center"><?php echo "Add New Education"?>
				<a href="#" id="btnCloseLocation" class="cancelDailog"></a>
			</div>
			<table style="width:100%; margin:0 auto;" cellpadding="3" cellspacing="0">
				
				<tr>
					<td>Education Level</td>
					<td><?php echo $form_edu->getElement("ed_name");?></td>
				</tr>
				<tr>
					<td>Status </td>
					<td><?php echo $form_edu->getElement("status");?></td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: center;">
						<input id="btn_add" Onclick="addNewEdu()" type="button" value="Add Education" />
						<input id="btncancel_edu" class="cancelDailog" type="button" value="Cancel" />
					</td>
					<td colspan="2"></td>
				</tr>
	       </table>
	     </form>
 		</div>
<script>



var index_edu = 0;
var option_edu = '<?php echo $this->education; ?>';

var baseUrl = '<?php echo BASE_URL; ?>';
var template = '';
var value = '';
// add order record
function addRow_Edu() {
	index_edu++; var first = index_edu;
	template='<tr id="row_edu'+index_edu+'" style="height:33px;">';
	var inp = '';
	if(index_edu == 1) {
		template+='<td class="quater-input" width="5%">&nbsp;</td>';
	} else {
		template+='<td class="quater-input" width="5%"><img onClick="deleteRecordEdu('+index_edu+')" src="<?php echo BASE_URL; ?>/images/icon/delete.gif" /></td>';
		//inp = '<input type="text" style="position: relative;margin-top: -15px; top:-15px; width: 211px;" onchange="AddLocation('+index_edu+')" class="validate[required] ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true" value="'+value+'">';
	}
	template+='<td class="quater-input" width="5%">'+index_edu+'</td>';
	template+='<td class="quater-input" width="30%"><select class="form-control validate[required]" onChange="ShowPopupEducation('+index_edu+ ')" id="edu_id_'+index_edu+'" name="edu_id_'+index_edu+'" >'+option_edu+'</select>'+inp+'</td>';
	template+='<td class="quater-input"><input type="text" class="form-control validate[required]" id="finish_from_'+index_edu+'" name="finish_from_'+index_edu+'" /></td>';
	template+='<td class="quater-input" width="20%"><input type="text" class="form-control validate[required]" id="year_'+index_edu+'" name="year_'+index_edu+'" /></td>';
	template+="</tr>";
	$('#table_edu').append(template);
	if($('#identity_edu').val()!="") {
		var identity_edu = $('#identity_edu').val();
		$('#identity_edu').val(identity_edu+','+index_edu);
	} else {$('#identity_edu').val(index_edu);}
	$("#orderFrm").validationEngine();
	//$("#edu_id_"+index_edu).chosen();
	
}
//add default row or record when click
$('#new_edu').click(addRow_Edu);
//add default row or record when ready
jQuery(document).ready(function(){
	addRow_Edu();
});
function deleteRecordEdu(index_edu) {
	var identity_edu = $('#identity_edu').val();
	var arrays = identity_edu.split(',');
	for(var i=0;i<arrays.length;i++) {
		if(arrays[i] == index_edu) arrays.splice(i,1);
	}
	var strings = arrays.join(',');
	$('#identity_edu').val(strings);
	$("#row_edu"+index_edu).remove();
}
var record_id = 1;
<?php $url_add_new_edu =  $this->url(array('module'=>'teacher','controller'=>'index','action'=>'add-new-education')); ?>
function addNewEdu(){
	var edu_name = $("#ed_name").val();
	var status = $("#status").val();
	validate_text('#ed_name');
	validate_text('#status');
		$.ajax({
	        url: "<?php echo $url_add_new_edu;?>",
	        type: "post",
	        data: {'ed_name':edu_name,'status':status},
	        success: function(data){
	           val = $.parseJSON(data);
	           //alert(val);
	           $('#edu_id_'+record_id).append($('<option></option>').attr('value',val).attr("selected",true).text($("#ed_name").val())); 
	           $('#edu_id_'+record_id).trigger("liszt:updated");
	            document.getElementById("frm-edu").reset();
	            HideDialog();
	        },
	        error:function(){
	            $("#result").html('There is error while submit');
	        }
	    });	
}
function ShowPopupEducation(index_edu){
	edu_id = $("#edu_id_"+ index_edu).val();
	alert(edu_id);
	record_id = index_edu;
	if(edu_id==-1){
		popUpNewEducaion(true);
	}
	
	
}
///////////////////////////Education//////////////////////////////////

function popUpNewEducaion(modal)
{
    $("#overlay-location").show();
    $("#dialog-edu").fadeIn(300);

    if (modal)
    {
        $("#overlay-location").unbind("click");
    }
    else
    {
        $("#overlay-location").click(function (e)
        {
        	HideDialogEducation();
        });
    }
}

function HideDialogEducation()
{
    $("#overlay-location").hide();
    $("#dialog-edu").fadeOut(300);
}

var index5 = 0;num=0;
var option5 = '<?php echo $this->subjects;?>';
var option5_skill = '<?php echo $this->skills;?>';
var baseUrl = '<?php echo BASE_URL; ?>';
var template = '';
var value = '';
function addRow(item_id) {
	index5++;
	for(i=1; i<index5; i++){
		new_subject=parseInt(item_id);
		subjects = parseInt($("#item_id_"+i).val());
		if(new_subject==subjects){
			if((free.checked==control.checked)){
				getSubject(i);
				return false;
			}
			else{
			}
		}
	}
	template='<tr id="row_remove'+index5+'" style="height:33px;" >';
	num=num+1;
	template+='<td class="quater-input"><img onClick="deleteRecord('+index5+')" src="<?php echo BASE_URL; ?>/images/icon/delete.gif" /></td>';
	template+='<td class="quater-input" width="3%">'+num+'<input type="hidden" value="" name="item_id_'+index5+'" id="item_id_'+index5+'" /></td>';
	template+='<td class="quater-input" width="100%"><select disabled="disabled"  class="form-control validate[required]" onChange="getSubject('+index5 +');" id="subject_id_'+index5+'" name="subject_id_'+index5+'">'+option5+'</select></td>';
	template+="</tr>";
	$('#table_order').append(template);
	if($('#identity').val()!="") {
		var identity = $('#identity').val();
		$('#identity').val(identity+','+index5);
	} else {$('#identity').val(index5);};
	$("#item_id_"+index5).val(item_id);
	$("#subject_id_"+index5).val(item_id);
	$("#frm").validationEngine();
	ids=$("#subject_id_"+index5).val();
}

var record_index= 1;
function getSubject(index){
	subject_id = $("#subject_id_"+ index).val();
	subject_id = $("#subject_id_"+ index).val();
	checksubjectQuantity(subject_id);
	if(subject_id==-1){
		     record_index = index;
			 ShowDialog(true);
	}
	else{
		if(subject_id== null || subject_id==''){
			alert('Please Select Subject ');
			return false;
	    }		
	}
}
<?php $url_dpt_filter =  $this->url(array('module'=>'teacher','controller'=>'index','action'=>'get-dpt-filter')); ?>
function getdptOrder(){
	var dpt_id = $('#department_id').val();
		$.ajax({
			url:"<?php echo $url_dpt_filter;?>",
			type:"post",
			data:{'dpt_id':dpt_id},
			success: function(data){
				items = $.parseJSON(data);
				if(items!=null){
					$('#add_subject').empty();
					 $('#add_subject').val('').trigger("liszt:updated");
					 $('#add_subject').append($("<option></option>").attr("value","").text("Please Select Subject"));
					 for (var index = 1 ; index <= items.length; index++) {
						 	//alert(items[index-1]['subject_id']);
							$('#add_subject').append($("<option></option>").attr("value",items[index-1]['subject_id']).text(items[index-1]['subject_name'])); 
							$("select#add_subject").find("option#add_subject[index-1]['subject_id']").attr("selected", true);
					 }               
					$('#add_subject').val('').trigger("liszt:updated");
				}else{
					 $('#add_subject').empty();
					 $('#add_subject').val('').trigger("liszt:updated");
					 $('#add_subject').append($("<option></option>").attr("value","").text("No Result!"));
					//$('#add_subject').val('').trigger("liszt:updated");
				}
			},
			error:function(){
			}
		});
}
function getsubjectOrder(){
	subject_ids=$("#add_subject").val();
	$('#add_subject').val('').trigger("liszt:updated");
	if(subject_ids==-1){
		return false;
	}
	addRow(subject_ids);
}
function deleteRecord(index) {
	var identity = $('#identity').val();
	var arrays = identity.split(',');
	for(var i=0;i<arrays.length;i++) {
		if(arrays[i] == index) arrays.splice(i,1);
	}
	var strings = arrays.join(',');
	$('#identity').val(strings);
	$("#row_remove"+index).remove();

	// subject_name price
	netsubject_name();
	dosubject_name();
}
///////////////////////////////////////
function addRowskill(itemsk_id) {
	index5++;
	for(i=1; i<index5; i++){
		new_skill = parseInt(itemsk_id);
		skill = parseInt($("#itemsk_id_"+i).val());
		if(new_skill==skill){
			if((free.checked==control.checked)){
				getSubject(i);
				return false;
			}
			else{
				addRowskill(skill);
			}
		}
	}
	
	template='<tr id="row_remove'+index5+'" style="height:33px;" >';
	num=num+1;
	template+='<td class="quater-input"><img onClick="deleteRecords('+index5+')" src="<?php echo BASE_URL; ?>/images/icon/delete.gif" /></td>';
	template+='<td class="quater-input" width="3%">'+num+'<input type="hidden" value="" name="itemsk_id_'+index5+'" id="itemsk_id_'+index5+'" /></td>';
	template+='<td class="quater-input" width="100%"><select  class="form-control validate[required]" onChange="getskills('+index5 +');" id="skill_id_'+index5+'" name="skill_id_'+index5+'">'+option5_skill+'</select></td>';
	template+="</tr>";
	$('#table_orders').append(template);
	if($('#identitysk').val()!="") {	
		var identitysk = $('#identitysk').val();
		$('#identitysk').val(identitysk+','+index5);
	} else {$('#identitysk').val(index5);};
	$("#itemsk_id_"+index5).val(itemsk_id);
	$("#skill_id_"+index5).val(itemsk_id);
	$("#frm").validationEngine();
	$("#skill_id_"+index5).val();
}
function getskill(){
	skill_id = $("#add_skill").val();
	skill_ids = $("#skill_id").val();
	$('#add_skill').val('').trigger("liszt:updated");
	if(skill_id != -1){
		//alert(skill_id);
		addRowskill(skill_id);
	}
	else if(skill_ids = ""){
		//alert(skill_ids);
		addRowskill(skill_ids);
		}
	else if(skill_id = -1){
		//alert(skill_id);
		addPupupskill(true);
	}
}

function deleteRecords(index) {
	var identitysk = $('#identitysk').val();
	var arrays = identitysk.split(',');
	for(var i=0;i<arrays.length;i++) {
		if(arrays[i] == index) arrays.splice(i,1);
	}
	var strings = arrays.join(',');
	$('#identitysk').val(strings);
	$("#row_remove"+index).remove();

	// subject_name price
	netskill_name();
	doskill_name();
}
var record_indexs= 1;
<?php $url_add_skill =  $this->url(array('module'=>'teacher','controller'=>'index','action'=>'addnewskill')); ?>
function addNewSkill(itemsk_id){
	value_label = $("#skills").val();
	$.ajax({	
        url: "<?php echo $url_add_skill;?>",
        type: "post",
        data: {'skills':value_label,'skill_status':$("#skill_status").val()},
        success: function(data){
            id = $.parseJSON(data);
            getskills=('getskills');
            $('#add_skill').append($("<option></option>").attr("selected",true).attr("value",id).attr("onChange",getskills).text($("#skills").val()));                       
			//$('#skill_id').next().val(skills);
            document.getElementById("frm-skill").reset();
            //$('#skills').trigger("liszt:updated");
            addRowskill(id);
            AddRecordOption(id,value_label);
            HideDialogskill();  
        	//addRowskill(skillss);
        },
        error:function(err){
            alert(err);
            alert("Failed to insert !");
        }
    });
}
function AddRecordOption(id,value_label){
	index_old =index5;
	skillss = $('#skill_id_'+index_old).append($("<option></option>").attr("value",id).attr("selected",true).attr("onChange",getskills).text(value_label));          
    
}
/////////////////////////////////////////////////
function ShowVendorDialog(modal)
{
    $("#overlay-vendor").show();
    $("#dialog-vendor").fadeIn(300);

    if (modal)
    {
        $("#overlay-vendor").unbind("click");
    }
    else
    {
        $("#overlay-vendor").click(function (e)
        {
            HideDialogVendor();
        });
    }
}
function HideDialogVendor()
{
    $("#overlay-location").hide();
    $("#dialog-location").fadeOut(300);
}
/* ************************************************************* */


//////////////////////////Skill//////////////////////////////////////

function addPupupskill(modal)
{
    $("#overlay-location").show();
    $("#dialog-location").fadeIn(300);

    if (modal)
    {
        $("#overlay-location").unbind("click");
    }
    else
    {
        $("#overlay-location").click(function (e)
        {
     	   HideDialogskill();
        });
    }
}

function HideDialogskill()
{
    $("#overlay-location").hide();
    $("#dialog-location").fadeOut(300);
}
/***************************************************************///popup
function ShowDialog(modal)
{
    $("#overlay").show();
    $("#dialog").fadeIn(300);

    if (modal)
    {
        $("#overlay").unbind("click");
    }
    else
    {
        $("#overlay").click(function (e)
        {
            HideDialog();
        });
    }
}

function HideDialog()
{
    $("#overlay").hide();
    $("#dialog").fadeOut(300);
} 
function HideshowAgentDialog()
{
    $("#agent_popup").hide();
    $("#dialog_popup").fadeOut(300);
} 
/********************************************/
//popup
$(document).ready(function ()
{
    $("#btnShow").click(function (e)
     {
          ShowDialog(true);
          e.preventDefault();
     });
    function add(){
    	ShowDialog(true);
     e.preventDefault();
    }
    $("#btnClose").click(function (e)
    {
        HideDialog();
        e.preventDefault();
    });
    $("#btnCancel").click(function (e)
            {
                HideDialog();
                e.preventDefault();
            });
    //for vendor

    $("#btnClosevendor").click(function (e)
            {
 	           HideDialogVendor();
                e.preventDefault();
            });
    $("#btnCancelVendor").click(function (e)
             {
 	            HideDialogVendor();
                 e.preventDefault();
             });
    $("#btnCloseLocation").click(function (e)
            {
 	           HideDialogskill();
                e.preventDefault();
            });
    $("#btncancel_location").click(function (e)
            {
 	           HideDialogskill();
                e.preventDefault();
            });
    $("#btncancel_edu").click(function (e)
            {
    			HideDialogEducation();
                e.preventDefault();
            });
    $("#cancelDailogAgent").click(function (e)
            {
 	           HideshowAgentDialog();
                e.preventDefault();
            });
    $("#btncancel_agent").click(function (e)
            {
 	           HideshowAgentDialog();
                e.preventDefault();
            });
    $("#btnCloseMeasure").click(function (e)
            {
    	HideMeasureDialog();
                e.preventDefault();
            });
            
});

$(".cancelDailog").click(function() {
	$(".required_error").removeAttr("style");
	$(".required_error").removeClass("required_error");
});
function validate_text(tname){//validate input text for dailog
	var tArray = tname.split(',');
	var d = '';
	
	$.each(tArray, function(index, value) {
		d = $(value).val();
		
		if(d == ''){
			$(value).attr("style","background-color:#fff; border:1px solid #FF90AB");
			$(value).addClass("required_error");
			
			exit();
		}else{
			$(".required_error").removeAttr("style");
			$(".required_error").removeClass("required_error");
		}
		
	});
}
function selectValue(){//use for select auto complet
	//$(".chzn-select-deselect").chosen({allow_single_deselect:false});
	//$("#item_id_1").chosen({allow_single_deselect:false});
	//$(".chzn-select").chosen(); $(".chzn-select-deselect").chosen({allow_single_deselect:false});
}
document.onmousedown=disableclick;
function disableclick(event)
{
  if(event.button==2)
   {
     return false;    
   }
}

</script>